package com.example.service;

import org.springframework.stereotype.Component;

@Component
public class TenantContext {
    private static final ThreadLocal<Tenant> currentTenant = new ThreadLocal<>();

    public void setCurrentTenant(Tenant tenant) {
        currentTenant.set(tenant);
    }

    public Tenant getCurrentTenant() {
        return currentTenant.get();
    }

    public void clear() {
        currentTenant.remove();
    }
}
